import {requests, requestsWithoutToken} from "@/api/request";
import type { HttpResponse, ServerResponse } from "@/class/HttpResponse";
import type User from "@/class/User";
import type { AxiosResponse } from "axios";

export const reqGetAuthorities =()=>requests<string[]>({
    url:'/user/authorities',
    method:'get',
})

export const reqPostUpdateUserHeader =(data:any)=>requests({
    url:"/user/updateUserHeader",
    method:'post',
    data:data,
})

export const reqPostUpdateUserPassword = (data:any)=>requests({
    url:"/user/updateUserPassword",
    method:'post',
    data:data,
})



export const reqLogin=(userinfo:User)=>requestsWithoutToken<Object>({
    url:'/user/login',
    data:userinfo,
    method:'post'
})
export const reqLogout=()=>requests({
    url:'/user/logout',
    method:'post',
})

export const reqUserInfo=()=>requests<User>({
    url:'/user/getInfo',
})
export  const reqRegister=(registerForm:User)=>requestsWithoutToken<User>({
    url:'/user/register',
    data:registerForm,
    method:'post',
})
export const reqCanRegister=()=>requests<boolean>({
    url:'/user/can_register',
})